import request from '@/utils/request'

// 查询商品信息列表
export function listCommodity(query) {
  return request({
    url: '/commodity/commodity/list',
    method: 'get',
    params: query
  })
}

// 查询商品信息详细
export function getCommodity(cid) {
  return request({
    url: '/commodity/commodity/' + cid,
    method: 'get'
  })
}

// 新增商品信息
export function addCommodity(data) {
  return request({
    url: '/commodity/commodity',
    method: 'post',
    data: data
  })
}

// 修改商品信息
export function updateCommodity(data) {
  return request({
    url: '/commodity/commodity',
    method: 'put',
    data: data
  })
}

// 删除商品信息
export function delCommodity(cid) {
  return request({
    url: '/commodity/commodity/' + cid,
    method: 'delete'
  })
}

export function getCategorys(query) {
  return request({
    url: '/commodity/commodity/category',
    method: 'get',
    params: query
  })


}
export function getCategory(gid) {
  return request({
    url: '/commodity/commodity/' + gid,
    method: 'get'
  })
}

//统计商品订单销售数据
export function salecount() {
  return request({
    url: '/commodity/commodity/salecount',
    method: 'get',
  })
}

//统计商品订单销售额数据
export function salegetcount() {
  return request({
    url: '/commodity/commodity/salegetcount',
    method: 'get',
  })
}

//统计商品进出货数据
export function SupplyAndDemand() {
  return request({
    url: '/commodity/commodity/SupplyAndDemand',
    method: 'get',
  })
}
